package com.freight.core.dto;

import com.freight.core.common.utils.NameUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.ColumnTransformer;

import javax.validation.constraints.Pattern;

@Data
public class UserMobileDto {

    @ApiModelProperty(value = "登录名")
    private String username;

    @ApiModelProperty(value = "用户类型 0货主 1司机")
    private Integer userType;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "验证码")
    private String code;

    @ApiModelProperty(value = "手机")
    @Pattern(regexp = NameUtil.regMobile, message = "11位手机号格式不正确")
    @ColumnTransformer(read = "AES_DECRYPT(UNHEX(mobile),'freight')"
            , write = "HEX(AES_ENCRYPT(?, 'freight'))")
    private String mobile;

}
